home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / ada / gwuada_6.zip / CODES.C < prev    next >
C/C++ Source or Header  |  1993-07-12  |  4KB  |  106 lines

  1. /*
  2.     GWAda Development Environment for 386/486 PCs   
  3.     Copyright (C) 1993, Arthur Vargas Lopes  & Michael Bliss Feldman
  4.                         vlopes@vortex.ufrgs.br mfeldman@seas.gwu.edu
  5.  
  6.     This program is free software; you can redistribute it and/or modify
  7.     it under the terms of the GNU General Public License as published by
  8.     the Free Software Foundation; version 2 of the License.    
  9.  
  10.     This program is distributed in the hope that it will be useful,
  11.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  12.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  13.     GNU General Public License for more details.
  14.  
  15.     You should have received a copy of the GNU General Public License
  16.     along with this program; if not, write to the Free Software
  17.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18. */
  19.  
  20. /*  Codes.c  */
  21.  
  22. #include "externs.h"
  23.  
  24. void AVL_BUILD_CODES()
  25. {
  26.         short i, j, k = 0;
  27.         /*  Mount Table  */
  28.         for(i = 0; i < 8; ++i)
  29.                 for(j = 0; j < 40; ++j)  {
  30.                         avl_mat_code[i][j] = ' ';
  31.                         if (k < 157)
  32.                                 avl_mat_code[i][++j] =  avl_codes[k++];
  33.                         else
  34.                                 avl_mat_code[i][++j] = ' ';
  35.                         }
  36. }
  37.  
  38.  
  39. void AVL_SHOW_CODES()
  40. {
  41.         short i, j, k = 0, co;
  42.         char line[41];
  43.         sprintf(line,"%40s"," ");
  44.         co = _settextcolor(avl_men_letter);
  45.         for(i = 0; i < 8; ++i)  {
  46.                 _settextposition(i + 1 , 1);
  47.                 _outtext(line);
  48.                 }
  49.         for(i = 0; i < 8; ++i)  {
  50.                 for(j = 0; j < 40; ++j)
  51.                         line[j] = avl_mat_code[i][j];
  52.                 line[40] = '\0';
  53.                 _settextposition(i+1,1);
  54.                 _outmem(line,40);
  55.                 }
  56.         _settextposition(avl_codes_row+1,avl_codes_col*2+1);
  57.         sprintf(line,"%c",16);
  58.         _settextcolor(4);
  59.         _outtext(line);
  60.         _settextcolor(co);
  61. }
  62.  
  63.  
  64. void AVL_INSERT_CODES()
  65. {
  66.         AVL_WIN_PTR w;
  67.         int ch;
  68.         AVL_BUILD_CODES();
  69.         w = AVL_MAKE_WINDOW(" Special Characters ",3,30,12,72,avl_men_bk_color,avl_wnd_color);
  70.         while ( 1 )  {
  71.                 AVL_SHOW_CODES();
  72.                 ch = getch();
  73.                 switch ( ch ) {
  74.                         case 27 : 
  75.                                 AVL_DEL_WINDOW(w);
  76.                                 return;
  77.                         case 13 :
  78.                                 AVL_DEL_WINDOW(w);
  79.                                 AVL_EDIT_INSERT(avl_mat_code[avl_codes_row][avl_codes_col*2+1]);
  80.                                 return;
  81.                         case  0   :
  82.                         case 0xE0 : {
  83.                                 ch = getch();
  84.                                 switch(ch)  {
  85.                                        case 72 : /* Up  */ 
  86.                                                 if (--avl_codes_row < 0) avl_codes_row = 7;
  87.                                                 break;
  88.                                        case 80 : /* Down */ 
  89.                                                 if (++avl_codes_row > 7) avl_codes_row = 0;
  90.                                                 break;
  91.                                        case 75 : /* Left */ 
  92.                                                 if (--avl_codes_col < 0) avl_codes_col = 19;
  93.                                                 break;
  94.                                        case 77 : /* Right */ 
  95.                                                 if (++avl_codes_col > 19) avl_codes_col = 0;
  96.                                                 break;
  97.                                        default : putch(7); break;
  98.                                        }
  99.                                 continue;
  100.                                 }
  101.                         default : putch(7); break;
  102.                         }
  103.                 }
  104. }
  105.  
  106.